{include file="public/header" select="0" /}
<body class="hide-top bgc">
<div class="submit-container">
    <img src="/static/index/img/icon55.png" alt="">
    <div class="submit-content">
        <div class="submit-hd flex-center">
            <i class="layui-icon layui-icon-left" onclick="goBack()"></i>确认订单
        </div>
        {if !$temporary.address}
        <div class="submit-site flex-layout add_address">
            <div>请选择收货地址</div>
            <i class="layui-icon layui-icon-right"></i>
        </div>
        {else}
        <div class="submit-site flex-layout choice_address">
            <div>
                <div>
                    <img src="/static/index/img/icon56.png" alt="">{$temporary.address.nickname}　{$temporary.address.tel}
                </div>
                <p>{$temporary.address.address}</p>
            </div>
            <i class="layui-icon layui-icon-right"></i>
        </div>
        {/if}
        <div class="submit-pro">
            <ul class="submit-pro-list">
                {foreach name="temporary.products" item="vo" }
                <li>
                    <p class="flex-center">
                        <img src="{$vo.icon}" alt="">
                    </p>
                    <div class="center">
                        <p class="multi">{$vo.title}</p>
                    </div>
                    <div class="rgt">
                        <p class="price">￥<span>{$vo.price}</span></p>
                        <p>x{$vo.num}</p>
                    </div>
                </li>
                {/foreach}
            </ul>
            <ul class="submit-pro-form">
                <li>留言
                    <input type="text" id="remark" placeholder="选填，填写内容请和卖家协商确认" autocomplete="off">
                </li>
            </ul>
        </div>
    </div>
</div>
<div class="submit-footer">
    <div>
        <p>合计：<span>￥{$temporary.total}</span></p>
    </div>
    <p class="flex-center submitOrder">提交订单</p>
</div>
{include file="public/footer" select="0" /}
<script>
    $(function () {
        var layer, form;
        layui.use(['layer', 'form'], function () {
            layer = layui.layer;
            form = layui.form;
            $('.submitOrder').click(function () {
                var address_id = '{$temporary.address?$temporary.address.id:""}';
                if (!address_id) {
                    layer.msg('请选择收货地址');
                    return false;
                }
                _ajax("{:url('order/submit')}", {address_id: address_id, remark: $('#remark').val()});
            });

            $('.add_address').click(function () {
                location.href = "{:url('address/add')}?type=add";
            });

            $('.choice_address').click(function () {
                layer.open({
                    type: 2,
                    anim: 2,
                    offset: 'b',
                    title: '请选择收货地址',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['100%', '90%'],
                    content: '{:url(\'address/index\')}?type=choice' //iframe的url
                });
            });
        });
    });
</script>
</body>
</html>